#!/bin/bash

MFILE=$1
KEY=$1
IDX=$2

if [ -z $MFILE ]; then
	echo "manpage - Generate a man script for a function or command";
	echo "  usage : manpage [FUNCTION|COMMAND]"
	exit 1
fi

if [ -z $IDX ]; then IDX="9"; fi

echo ".TH man $IDX `date +\"%d %b %Y\"` \"1.0\" \"$KEY man page\""
echo ".SH NAME"
echo "$KEY - <description>"
echo ".SH SYNOPSIS"
echo "#include <HEADER>"
echo ".TP"
echo "void $KEY(int param1, int param2)"
echo ".SH DESCRIPTION"
echo ".SH PARAMETERS"
echo ".B param1"
echo "param1 <description>"
echo ".TP"
echo ".BR param2"
echo "param2 <description>"
echo ".SH RETURN VALUE"
echo "<description>"
echo ".SH SEE ALSO"
